<?php
	require('../functions/xml.class.php');
	
	$parserXML = new XmlParser();
		
	$xml = $parserXML->loadXML("InterfaceInterface.xml");
	$answer = $parserXML->loadXML("answer.xml");
	
	foreach($xml->Sample as $sample) {
		echo "<table width=\"100px\" border=\"1\">\n";		
		echo "<caption>".$sample->Date."</caption>\n";
		echo "<tr><th>ID</th><th>Nombre</th><th>MAX.</th><th>MIN.</th><th>VALUE</th></tr>";
		foreach($sample->DataSample as $dataSample) {
			foreach($dataSample->ValueForVar as $var) {
				foreach($answer->New->Property as $property) {
					if (strval($property->VarId) == strval($var->VarId)) {
						echo "<tr><td>".$var->VarId."</td>";
						echo "<td>".$property->Name."</td>";
						echo "<td>".$property->Max."</td>";
						echo "<td>".$property->Min."</td>";
						if((strval($var->Value) > strval($property->Min)) && (strval($var->Value) < strval($property->Max)))
							echo "<td bgcolor=\"#00FF00\">".$var->Value."</td></tr>\n";
						else
							echo "<td bgcolor=\"#FF0000\">".$var->Value."</td></tr>\n";
					}
				}
			}
		}
		echo "</table>";
	}
	
	//unlink("answer.xml");
	//unlink("ask.xml");

?>